import 'package:flutter/material.dart';

class AppDivider extends StatelessWidget {
  ///粗细
  final double weight;

  ///颜色
  final Color color;

  ///方向
  final Axis direction;

  ///边距
  final EdgeInsetsGeometry padding;

  const AppDivider({
    Key key,
    this.weight = 1,
    this.color,
    this.direction = Axis.horizontal,
    this.padding = const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding,
      child: Container(
        height: direction.index == 0 ? weight : double.infinity,
        width: direction.index == 0 ? double.infinity : weight,
        color: color ?? Theme.of(context).dividerColor,
      ),
    );
  }
}
